package com.en.sharing.enums;

import java.math.BigDecimal;
import java.util.function.BiFunction;

/**
 * 运算
 *
 * @author 付晓飞
 * @date 2024/3/12 8:14 下午
 */
public enum OperateEnum2 implements IOperate {

    /**
     * 加、减(乘、除 省略)
     */
    PLUS((t1, t2) -> t1.longValue() + t2.longValue()),
    REDUCE((t1, t2) -> t1.longValue() - t2.longValue()),
    DEVICE((t1, t2) -> t1.longValue() / t2.longValue()),
    MULTIPLY((t1, t2) -> t1.longValue() * t2.longValue()),
    ;

    OperateEnum2(BiFunction<Number, Number, Number> operateFuction) {
        this.operateFuction = operateFuction;
        BigDecimal b;
    }

    private BiFunction<Number, Number, Number> operateFuction;



    @Override
    public Number operate(Number t1, Number t2) {
        return operateFuction.apply(t1, t2);
    }


}
